home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / osi / isode / vmsisode / vmsgcc139_tar.Z / vmsgcc139_tar / include / stdarg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  1.1 KB  |  40 lines

  1. #ifndef _STDARG_H
  2. #define _STDARG_H
  3.  
  4. /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
  5. #ifndef _VA_LIST_
  6. #define _VA_LIST_
  7. typedef char *va_list;
  8. #endif
  9.  
  10. /* Amount of space required in an argument list for an arg of type TYPE.
  11.    TYPE may alternatively be an expression whose type is used.  */
  12.  
  13. #define __va_rounded_size(TYPE)  \
  14.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  15.  
  16. #ifndef __sparc__
  17. #define va_start(AP, LASTARG)                         \
  18.  (AP = ((char *) __builtin_next_arg ()))
  19. #else
  20. #define va_start(AP, LASTARG)                         \
  21.  (__builtin_saveregs (),                        \
  22.   AP = ((char *) __builtin_next_arg ()))
  23. #endif
  24.  
  25. void va_end (va_list);        /* Defined in gnulib */
  26. #define va_end(AP)
  27.  
  28. #ifdef __mips__
  29. #define va_arg(AP, mode) ((mode *)(AP = \
  30.     (char *) (sizeof(mode) > 4 ? ((int)AP + 2*8 - 1) & -8 \
  31.                    : ((int)AP + 2*4 - 1) & -4)))[-1]
  32. #else /* not __mips__ */
  33. #define va_arg(AP, TYPE)                        \
  34.  (*((TYPE *) (AP += __va_rounded_size (TYPE),                \
  35.           AP - (sizeof (TYPE) < 4 ? sizeof (TYPE)            \
  36.             : __va_rounded_size (TYPE)))))
  37. #endif /* not __mips__ */
  38.  
  39. #endif /* _STDARG_H */
  40.